<template>
  <ul class="todo-list">
    <!-- completed: 完成的类名 -->
    <!-- 打勾跟着表单的数据来进行渲染 -->
    <li :class="{ completed: obj.isDone }" v-for="obj in arr" :key="obj.id">
      <div class="view">
        <input class="toggle" type="checkbox" v-model="obj.isDone" />
        <label>{{ obj.name }}</label>
        <button class="destroy" @click="delFn(obj.id)"></button>
      </div>
    </li>
  </ul>
</template>

<script>
export default {
  name: "nmdzq",
  props: ["arr"],
  methods: {
    delFn(id){
      // 子转父
      // 将点击的id传给父
      this.$emit('del',id)
    }
  }
};
</script>